<?php

/*
 * Action - Attack - Knight 5$
 *
 * You may trash up to 2 cards from your hand.
 * Each other player reveals the top 2 cards of his deck, trashes one of them costing from 3 Coin to 6 Coin, and discards the rest. If a Knight is trashed by this, trash this card.
 */

class DameAnna extends Card implements iAction, iKingdom, iDarkAges, iKnight, iAttack {

    public function __construct() {
        parent::__construct("Dame Anna", 5);
        $this->undoPlay = false;
        $this->undoBuy = false;
    }

    public function getDescription() {
        return array(
            "You may trash up to 2 cards from your hand.",
            "Each other player reveals the top 2 cards of his deck, trashes one of them costing from 3 Coin to 6 Coin, and discards the rest. If a Knight is trashed by this, trash this card.");
    }

    public function play(Game $game, $isRealCard) {
        $game->attack($this);
        $cards = $game->getPlayHand();
        if (sizeof($cards) > 0) {
            $options = array(new Option(1, "Yes"), new Option(2, "No"));
            $output = MySocket::GetUserReply($game, Input_ChooseOne, $options, 1, 1, null, "Trash up to 2 cards from your hand?");
            if ($output[0] == "Yes") {
                $output = MySocket::GetUserReply($game, Input_ChooseMany, $cards, 0, 2, null, "Choose cards to trash");

                foreach ($output as $p) {
                    $game->moveCardFromPileToPile($p, PlayHand, Trash);
                }

                ScreenDisplay::addScreenMessage($game, true, "trash " . nicePrint($output), "trashes " . ScreenDisplay::$LMSG);
            }
        }


        $knight = new Knights();
        $knight->knightAttack($game, $this);
        $game->cardActionFinished();
        return true;
    }

    

}

?>